package com.dtm.server;

import java.util.ArrayList;

	
public class UpdateListServerSubThread extends Thread{
	private ArrayList<ClientThread> clientsList;
	public UpdateListServerSubThread(ArrayList<ClientThread> clientsList) {
		this.clientsList = clientsList;
	}
	
	@Override
	public void run() {
		int top = clientsList.size() - 1;
		String message = "" + ClientThread.UDL + clientsList.get(top).getClientName().length() + clientsList.get(top).getClientName() + clientsList.get(top).getClientID() + clientsList.get(top).getClientStatus();
		for(int i = 0; i < clientsList.size(); i++) {
			clientsList.get(i).sendToRemoteDevice(message);
			clientsList.get(top).sendToRemoteDevice(""+ ClientThread.UDL + clientsList.get(i).getClientName().length() + clientsList.get(i).getClientName() + clientsList.get(i).getClientID() + clientsList.get(i).getClientStatus());
		}
	}
}